#include"../common/threadpool.h"
#include"unistd.h"

void print_str(void* args){
    char*str=(char*)args;
    //sleep(1);
    printf("%s\n",str);
}

int main(){
    threadpool *tp=create_threadpool(4);
    worker w1;
    w1.pool=tp;
    w1.data="worker:1";
    w1.work=print_str;
    worker w2;
    w2.pool=tp;
    w2.data="worker:2";
    w2.work=print_str;
    worker w3;
    w3.pool=tp;
    w3.data="worker:3";
    w3.work=print_str;
    worker w4;
    w4.pool=tp;
    w4.data="worker:4";
    w4.work=print_str;
    worker w5;
    w5.pool=tp;
    w5.data="worker:5";
    w5.work=print_str;
    worker w6;
    w6.pool=tp;
    w6.data="worker:6";
    w6.work=print_str;
    execute_threadpol(&w1);
    execute_threadpol(&w2);
    execute_threadpol(&w3);
    execute_threadpol(&w4);
    execute_threadpol(&w5);
    execute_threadpol(&w6);
    //sleep(1);
    printf("after sleep!\n");
    shutdown_threadpool(tp);
    destory_threadpool(tp);
    return 0;
}